<template>
  <el-col style="margin: 10px auto;max-width: calc(100vw - 210px);">
    <div style="margin-top: 50px;"></div>
      <div style="min-height: 20%">
        <el-card style="border-radius: 20px">
          <el-input v-model="keyWords" placeholder="请输入关键词" style="width: 300px;margin-left: calc(100vw - 750px)"
                    clearable></el-input>
          <el-button type="primary" style="width: 85px;margin-left: 10px">搜索</el-button>
          <el-button type="default" style="width: 85px">新增职位</el-button>
        </el-card>
        <el-card style="border-radius: 20px;margin-top: 10px">
          <template #header>
            <el-button link :type="t1" @click="bt1">全部职位</el-button>
            <el-button link :type="t2" @click="bt2">运作中</el-button>
            <el-button link :type="t3" @click="bt3">已停止</el-button>
            <el-button link :type="t4" @click="bt4">已交付</el-button>
          </template>
          <el-table
              :data="PositionListCopy"
              style="border-radius: 15px"
              height="460"
          >
            <el-table-column prop="poname" label="职位名称"/>
<!--            <el-table-column prop="" label="待初筛"/>-->
<!--            <el-table-column prop="" label="已初筛"/>-->
<!--            <el-table-column prop="" label="已推荐"/>-->
<!--            <el-table-column prop="" label="已初试"/>-->
<!--            <el-table-column prop="" label="已复试"/>-->
<!--            <el-table-column prop="" label="已终试"/>-->
<!--            <el-table-column prop="" label="已offer"/>-->
<!--            <el-table-column prop="" label="已入职"/>-->
<!--            <el-table-column prop="" label="已过保"/>-->
<!--            <el-table-column prop="" label="已淘汰"/>-->
<!--            <el-table-column prop="" label="已投递数"/>-->
            <el-table-column prop="potime" label="更新时间" sortable/>
            <el-table-column fixed="right" label="操作" width="120">
              <template #default="scope">
                <el-button link type="primary" size="small" @click="editClick(scope.row)">编辑</el-button>
                <el-popconfirm title="确定删除吗？" @confirm="deleteClick(scope.row.id)">
                  <template #reference>
                    <el-button link type="danger" size="small">删除</el-button>
                  </template>
                </el-popconfirm>
              </template>
            </el-table-column>
          </el-table>

        </el-card>
      </div>
  </el-col>
</template>

<script>
import request from "@/utils/request";
export default {
  name: "PositionList",
  components: {},
  data() {
    return {
      t1: "primary",
      t2: "default",
      t3: "default",
      t4: "default",
      PositionList: [],
      PositionListCopy:[],
      keyWords: "",

    }
  },

  created() {
    this.load()
  },
  methods: {
    load(){
      request.get("/position/load",{}).then(res=>{
        console.log(res)
        this.PositionList=res.data
        this.PositionListCopy=this.PositionList
      })
    },
    bt1() {
      this.t1 = "primary"
      this.t2 = "default"
      this.t3 = "default"
      this.t4 = "default"
      this.load()
    },
    bt2() {
      this.t2 = "primary"
      this.t1 = "default"
      this.t3 = "default"
      this.t4 = "default"
      let tmp=[]
      for (var t in this.PositionList){
        if(this.PositionList[t].postate == 0){
          tmp.push(this.PositionList[t])
        }
      }
      this.PositionListCopy=tmp
    },
    bt3() {
      this.t3 = "primary"
      this.t2 = "default"
      this.t1 = "default"
      this.t4 = "default"
      let tmp=[]
      for (var t in this.PositionList){
        if(this.PositionList[t].postate == 1){
          tmp.push(this.PositionList[t])
        }
      }
      this.PositionListCopy=tmp
    },
    bt4() {
      this.t4 = "primary"
      this.t2 = "default"
      this.t3 = "default"
      this.t1 = "default"
      let tmp=[]
      for (var t in this.PositionList){
        if(this.PositionList[t].postate == 2){
          tmp.push(this.PositionList[t])
        }
      }
      this.PositionListCopy=tmp
    },
  },
}
</script>

<style scoped>


</style>